<?php
// @formatter:off
/**
 * @file WCParserBehaviorIGNORE.php
 * @author Alejandro Dario Simi
 * @date $Date: 2013-07-11 21:02:48 +0000 (Thu, 11 Jul 2013) $
 *
 * $Id: WCParserBehaviorIGNORE.php 95 2013-07-11 21:02:48Z daemonraco@gmail.com $
 * $URL: http://wcomix.googlecode.com/svn/tags/wcomix-1.0.0.1/includes/parser/WCParserBehaviorIGNORE.php $
 */
// @formatter:on

//
// Loading father class.
require_once dirname(__FILE__)."/WCParserBehavior.php";

//
// Adding the function to evaluate by this behavior.
$wcParserBehaviorMatrix["IGNORE"] = "WCParserBehaviorIGNORE";
$wcParserBehaviorMatrix["!"] = "WCParserBehaviorIGNORE";

/**
 * @class WCParserBehaviorIGNORE This is a specific behavior that emulates a code
 * comment. When it's used it looks like:
 * @code
 * <:IGNORE:/>contents<::/>
 * <:!:/>contents<::/>
 * @endcode
 */
class WCParserBehaviorIGNORE extends WCParserBehavior {
	/**
	 * This method perform a check of the object, sets the current status
	 * (variable $this->_ok) and return it.
	 *
	 * @return boolean Returns the current status after a check.
	 */
	public function check() {
		//
		// An ISSET behavior must belong to a parser node.
		if($this->_node) {
			//
			// At this point, everything checks out.
			$this->_ok = true;
			$this->_errorMsg = "Ok";
		} else {
			//
			// Behavior's node is not present. Error message is set
			// and the internal status becomes false.
			$this->_errorMsg = "IGNORE node is not set";
			$this->_ok = false;
		}
		//
		// Returning current object status.
		return $this->isOk();
	}
	/**
	 * Since this is a comment behavior, nothing will be generated when
	 * calling this method.
	 *
	 * @return string Returns an empty string unless there's a problem, in
	 * which returns false.
	 */
	public function get() {
		//
		// Setting the default value to be returned.
		$out = false;
		//
		// IGNORE condition will only be evaluated when this behavior has
		// no issues.
		if($this->isOk()) {
			//
			// It always returns an empty string.
			$out = "";
		}
		//
		// Returning evaluation results.
		return $out;
	}
}
?>